package org.ccay.instrument;
import java.lang.instrument.Instrumentation;

import org.ccay.override.TplOverrideTransformer;

public class OverrideInstrumentation
{
  private static volatile Instrumentation instrumentation;
  
  public static void premain(String agentArgs, Instrumentation inst)
  {
    instrumentation = inst;
    onInstrumentationSaved();
  }
  
  public static void agentmain(String agentArgs, Instrumentation inst)
  {
    instrumentation = inst;
    onInstrumentationSaved();
  }
  
  public static void onInstrumentationSaved(){
	  instrumentation.addTransformer(new TplOverrideTransformer());
  }
  
  public static Instrumentation getInstrumentation()
  {
    return instrumentation;
  }
}
